package com.gin.no_gay_alliance.viewmodel.notice;

import android.os.Parcel;
import android.os.Parcelable;

import com.gin.nga.response.field.notice.RecommendNotice;

/**
 * 赞踩提醒
 *
 * @author : ginstone
 * @version : v1.0.0
 * @since : 2023/9/11 10:54
 **/
public class RecommendNoticeModel extends BaseNoticeModel<RecommendNotice> implements Parcelable {
    public static final Creator<RecommendNoticeModel> CREATOR = new Creator<RecommendNoticeModel>() {
        @Override
        public RecommendNoticeModel createFromParcel(Parcel in) {
            return new RecommendNoticeModel(in);
        }

        @Override
        public RecommendNoticeModel[] newArray(int size) {
            return new RecommendNoticeModel[size];
        }
    };
    /**
     * 主题标题
     */
    public String topicTitle;
    /**
     * 主题id
     */
    public Long topicId;
    /**
     * 回复id
     */
    public Long replyId;
    /**
     * 页数
     */
    public Integer page;

    public RecommendNoticeModel() {
    }

    public RecommendNoticeModel(RecommendNotice recommendNotice) {
        super(recommendNotice);

        this.topicTitle = recommendNotice.getTopicTitle();
        this.topicId = recommendNotice.getTopicId();
        this.replyId = recommendNotice.getReplyId();
        this.page = recommendNotice.getPage();
    }

    protected RecommendNoticeModel(Parcel in) {
        super(in);
        topicTitle = in.readString();
        if (in.readByte() == 0) {
            topicId = null;
        } else {
            topicId = in.readLong();
        }
        if (in.readByte() == 0) {
            replyId = null;
        } else {
            replyId = in.readLong();
        }
        if (in.readByte() == 0) {
            page = null;
        } else {
            page = in.readInt();
        }
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        super.writeToParcel(dest, flags);
        dest.writeString(topicTitle);
        if (topicId == null) {
            dest.writeByte((byte) 0);
        } else {
            dest.writeByte((byte) 1);
            dest.writeLong(topicId);
        }
        if (replyId == null) {
            dest.writeByte((byte) 0);
        } else {
            dest.writeByte((byte) 1);
            dest.writeLong(replyId);
        }
        if (page == null) {
            dest.writeByte((byte) 0);
        } else {
            dest.writeByte((byte) 1);
            dest.writeInt(page);
        }
    }
}
